import request from '@/request'

interface LoginRequestData {
  account: string
  password: string;
}

interface LoginResponese {
  token: string
}

interface RegisterRequestData {
  nickname: string;
  account: string
  password: string;
}

interface RegisterResponese {
  nickname: string,
  account: string,
  id: string,
}

export const loginRequest = (data: LoginRequestData) => {
  return request<LoginResponese>({
    method: "POST",
    url: '/user/login',
    data
  })
}

export const registerRequest = (data: RegisterRequestData) => {
  return request<RegisterResponese>({
    method: "POST",
    url: '/user/register',
    data
  })
}